<extend name="public:base" />

<block name="left">
	<div class="mark_bar cl">
		<a href="{:url('user/index/index')}" class="goback fl"><i class="iconfont">&#xe600;</i></a>
		<p>站内信</p>
		<!--<a href="{:url('index/article/lists',['cid'=>321])}" class="btm">平台公告</a>-->
	</div>
</block>

<block name="main">
	<div class="content">
		<ul class="msg_list">
			<notempty name="list">
				<volist name="list" id="v">
					<li data="{$v.info}" data-id="{$v.id}" <if condition='$v.status eq 1'>class="read"</if>>
						<p>{$v.title}</p>
						<div class="more small">
							<span>查看详情</span>
							<span class="fr">{$v.create_time}<i class="iconfont">&#xe611;</i></span>
						</div>
					</li>
				</volist>
				<else/>
				<div class="empty">暂无站内信！</div>
			</notempty>
		</ul>
		<div class="page">{$page|default=''}</div>
	</div>
</block>

<block name="menu"></block>

<block name="js">
	<script type="text/javascript">
		$(function() {
			$('.msg_list li').on('click', function() {
				var _this = $(this);
				layer.open({
					content: _this.attr('data'),
					closebtn:true
				});

				if(!_this.hasClass('read')) {
					$.ajax({
						type: "POST",
						url: "{:url('user/msg/read')}",
						async: true,
						dataType: 'json',
						data: {
							'ids':_this.attr('data-id')
						},
						success: function(d) {
							if(d.code == 1) {
								_this.addClass('read');
							}
						}
					});
				}
			})
		})
	</script>
</block>